package tasks;

import android.os.AsyncTask;
import android.util.Log;

import com.wenxin.administrator.zhufengfm.Constants;

import org.json.JSONException;
import org.json.JSONObject;

import client.ClientAPI;
import utils.EntityParseUtil;

/**
 * Created by Administrator on 15-10-20.
 */
public class DiscoverRecommendTask extends  BaseTask {

    public DiscoverRecommendTask(TaskCallBack callBack) {
        super(callBack);

    }

    protected TaskResult doInBackground(String... strings) {
        TaskResult ret=new TaskResult();
        ret.action= Constants.TASK_ACTION_DISCOVER_RECOMMENDS;
        JSONObject jsonObject= ClientAPI.getDiscoverRecommed("and-f6", true, true);
        Log.d("Task","task"+jsonObject);
        if(jsonObject!=null)
        {
            try {
                ret.resultCode=jsonObject.getInt("ret");
                //解析数据
                ret.data= EntityParseUtil.parseDiscoverRecommends(jsonObject);
                Log.d("Task",ret.toString());
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
        return ret;
    }


}
